$(function () {
    findTop();
});
function findTop() {
    $.ajax({
        url: '/top',
        data: {},
        type: 'get',
        dataType: 'json',
        success: function (res) {
            console.log(res);
            setCompanyData(res.companyModel);
            setNavData(res.navModelList);
        }
    })
}

function setCompanyData(data) {
    $("#logo").attr("src", data.logo);
    $("#phone").html(data.phone);
    $("#net").html("网址:" + data.net);
    $("#email").html(data.email);
    $("#linePhone").html(data.linePhone);
    $("#address").html("联系地址:" + data.address);
    $("#version").html(data.version);
}

function setNavData(data) {
    let html = '';
    for (let i = 0; i < data.length; i++) {
        html += ' <div onclick="window.location.href=\''+data[i].href+'\'"> '+data[i].title+'</div>';
    }
    $("#nav").html(html);
}